<?php

namespace api\modules\v1\models\shop;

use api\modules\v1\models\Common;
use common\models\shop\GoodsDetailBanner;

/**
 * This is the model class for table "goods".
 *
 * @property int $id
 * @property string $name
 */
class GoodsBanner extends GoodsDetailBanner
{

    public static function getBannerByGoodsDetailId($goodsDetailId = 0) {
        if (empty($goodsDetailId)) {
            return [];
        }
        $where['goods_detail_id'] = $goodsDetailId;
        $order = "goods_order ASC";
        $list = static::getByWhere($where, ['goods_image'], $order);

        $banners = array_column($list, 'goods_image');
        foreach ($banners as $k => $v) {
            $banners[$k] = static::getImages($v);
//            $result[] = [
//                'status' => 'finished',
//                'name' => $v,
//                'url' => static::$staticQiniuHost . $v,
//            ];
        }
        return $banners;
    }
}
